Skip to content

Implementation for Google OAuth #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

NaveenKY
Copy link

@NaveenKY NaveenKY commented Mar 3, 2018

Added OAuth Implementation for Google

@dharapvj
Copy link
Contributor

dharapvj commented Mar 5, 2018

@NaveenKY - Thanks much for the PR. Let me test this quickly and will revert to you today about this.

@@ -4,6 +4,7 @@
"license": "MIT",
"scripts": {
"start": "ng serve",
"start:https": "ng serve --ssl true --host 0.0.0.0 --port 8443",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a line in README.md to explain how to experience Oauth based application?

Copy link
Contributor

@dharapvj dharapvj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content is good. Can we make more user friendly in UI and also can we write a section in README / Wiki about how it works .. how to use it etc.

@@ -21,6 +23,19 @@ export class HeaderComponent implements OnInit {
items: [{ label: 'Project' }, { label: 'Other' }]
},
{ label: 'Open', routerLink: ['pagename'] },
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the "Login" and "Logged In User's name" in the toolbar instead on right aligned menu item?

This way it will be far more "real life"..

<div class="oauth-home">
<div>
Your Google Access Token :
<span class="information">{{accessToken}}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is good...
May be we show this as a tooltip / on-click tooltip to user when user clicks on "Signed-In User" in the toolbar icon as suggested elsewhere.

this.activeRoute.params.subscribe(params => {
const url = window.location.href;
if (url.split('#').length > 1) {
const responseParameters = url.split('#')[1].split('&');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of URL splitting is very shaky.. as # is not guaranteed to be present in the URL.

We should be using paramMap to read params.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is while reading the access token from URL. This is standard OAuth specification that the values will be separated by #

constructor(private http: HttpClient) {}

public getUserInfo(accessToken): Observable<any> {
return this.http.post(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${accessToken}`, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this URL be externalized in environment file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to move it to env file.. will make this change.

LOG_LEVEL: 'warn'
LOG_LEVEL: 'warn',
AUTH_URL: 'https://accounts.google.com/o/oauth2/v2/auth',
OAUTH_CLIENT_ID: '603712460284-9c20vfg98ra1cecdhu2r84d4ij6erpcr.apps.googleusercontent.com'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this CLIENT_ID permanent?

Also - can we add this in README.md section on OAuth that such client is needed and how do we register to get it?

@@ -4,6 +4,7 @@
"license": "MIT",
"scripts": {
"start": "ng serve",
"start:https": "ng serve --ssl true --host 0.0.0.0 --port 8443",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we should probably mention how / where to make changes to make OAuth using popup instead of page refresh in this README.md section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants