-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: master
Are you sure you want to change the base?
Conversation
@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", |
There was a problem hiding this comment.
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?
There was a problem hiding this 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'] }, | |||
{ |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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('&'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}`, ''); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
Added OAuth Implementation for Google