質問編集履歴

1

プログラムを変えたときの結果を追加

2018/10/11 07:01

投稿

Kunoki
Kunoki

スコア11

test CHANGED
File without changes
test CHANGED
@@ -61,3 +61,69 @@
61
61
 
62
62
 
63
63
  なにか良い方法はないでしょうか。
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+ **追記**
72
+
73
+ プログラムを↓のように直した結果
74
+
75
+ ```angular
76
+
77
+ OAuth1() {
78
+
79
+ var httpObj = this.http.get(this.OAuthURL1,
80
+
81
+ {
82
+
83
+ headers: new HttpHeaders({
84
+
85
+ 'Content-Type': 'application/json'
86
+
87
+ }),
88
+
89
+ params: new HttpParams({
90
+
91
+ client_id: this.clientId,
92
+
93
+ redirect_url: this.redirectUrl,
94
+
95
+ scope: "", // default is empty
96
+
97
+ state: this.state,
98
+
99
+ allow_singup: false // default is true
100
+
101
+ })
102
+
103
+ });
104
+
105
+ console.log(this.githubApiParam1);
106
+
107
+ httpObj.subscribe(this.OAuth1Next, this.RequestError);
108
+
109
+ }
110
+
111
+ ```
112
+
113
+ エラー文が次のようになっています
114
+
115
+ ```
116
+
117
+ //webブラウザより
118
+
119
+ Refused to set unsafe header "Origin"
120
+
121
+
122
+
123
+ Failed to load resource: the server responded with a status of 404 (Not Found)
124
+
125
+
126
+
127
+ Failed to load https://github.com/login/oauth/authorize: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access
128
+
129
+ ```