Skip to content

Commit 56f6f2a

Browse files
committed
Added default value for scopes
1 parent 58ec98f commit 56f6f2a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

projects/github-auth-lib/src/lib/services/github-auth.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ export class GithubAuthService {
3030
}
3131

3232
login() {
33+
let scopes = '';
34+
if (!this.config.scopes) {
35+
scopes = 'user'
36+
}
37+
else {
38+
scopes = this.config.scopes.join('%20');
39+
}
3340
let url = `https://github.com/login/oauth/authorize`
3441
+ `?client_id=${this.config.clientId}`
3542
+ `&state=${this.generateRandomString(40)}`
3643
+ `&redirect_uri=${this.config.redirectUrl}`
37-
+ `&scope=${this.config.scopes.join('%20')}`
44+
+ `&scope=${scopes}`
3845
window.open(url, '_self');
3946
}
4047

0 commit comments

Comments
 (0)