我正在尝试使用开发人员文档来使用Instagram OAuth
https://www.instagram.com/developer/authentication/.
第1步和第2步没有任何问题,所以我有我Client-ID
的Client-Secret
,所有Redirect-URI
和代码.
但每次我试图得到Acces Token
我得到以下错误:
{
"code": 400,
"error_type": "OAuthException",
"error_message": "Matching code was not found or was already used."
}
Run Code Online (Sandbox Code Playgroud)
任何提示如何解决这个问题?
我正在使用Spring Boot(最新版本,1.3.6),我想创建一个REST端点,它接受一堆参数和一个JSON对象.就像是:
curl -X POST http://localhost:8080/endpoint \
-d arg1=hello \
-d arg2=world \
-d json='{"name":"john", "lastNane":"doe"}'
Run Code Online (Sandbox Code Playgroud)
在我正在做的Spring控制器中:
public SomeResponseObject endpoint(
@RequestParam(value="arg1", required=true) String arg1,
@RequestParam(value="arg2", required=true) String arg2,
@RequestParam(value="json", required=true) Person person) {
...
}
Run Code Online (Sandbox Code Playgroud)
该json
参数不会被序列化为Person对象.我得到了
400 error: the parameter json is not present.
Run Code Online (Sandbox Code Playgroud)
显然,我可以将json
参数作为String并解析控制器方法中的有效负载,但这种方式无视使用Spring MVC.
如果我使用它,它都可以工作@RequestBody
,但是我放弃了在JSON主体之外POST单独的参数的可能性.
Spring MVC中有没有办法"混合"普通的POST参数和JSON对象?
我目前正在做一个需要 64 位解码的项目,经过一些研究,我在 java 本身中发现了这两种方法,
来自JAVA 8
import java.util.Base64;
byte[] decodedBytes = Base64.getDecoder().decode("encodedUserPassword");
Run Code Online (Sandbox Code Playgroud)
从JAVA 6
import javax.xml.bind.DatatypeConverter;
byte[] decodedBytes = DatatypeConverter.parseBase64Binary("encodedUserPassword");
Run Code Online (Sandbox Code Playgroud)
我想知道的是为什么需要Base64
ifDatatypeConverter
已经存在?
有不同的表现吗?
我试图使用hibernate条件查询从表中选择列
Criteria cr = session.createCriteria(OfferCashbackMaster.class)
.setProjection(Projections.projectionList()
.add(Projections.property("txnType"), "txnType")
.add(Projections.property("off_Discription"), "off_Discription"))
.setResultTransformer(Transformers.aliasToBean(OfferCashbackMaster.class))
.add(Restrictions.and(Restrictions.eq("aggregatorId", aggregatorId),
Restrictions.eq("txnType", txnType)));
Run Code Online (Sandbox Code Playgroud)
txnType
投影中提到的名称与限制发生冲突.
给我以下错误
Hibernate:
select
this_.OFFER_CODE as y0_,
this_.TXN_TYPE as y1_,
this_.VALID_TO as y2_,
this_.OFFER_DISCRIPTION as y3_
from OFFER_CASHBACK_MASTER this_
where
(this_.AGGREGATOR_ID=? and y1_=?)
2018-02-25/15:42:41.756 WARN: util.JDBCExceptionReporter -
SQL Error: 1054, SQLState: 42S22
2018-02-25/15:42:41.757 ERROR: util.JDBCExceptionReporter -
Unknown column 'y1_' in 'where clause'
Run Code Online (Sandbox Code Playgroud)
我们如何解决这个问题?
我的应用程序使用AngularJS作为前端,使用.NET作为后端.
在我的应用程序中,我有一个列表视图.在单击每个列表项时,它将从S3获取预呈现的HTML页面.
我正在使用角度状态.
app.js
...
state('staticpage', {
url: "/staticpage",
templateUrl: function (){
return 'http://xxxxxxx.cloudfront.net/staticpage/staticpage1.html';
},
controller: 'StaticPageCtrl',
title: 'Static Page'
})
Run Code Online (Sandbox Code Playgroud)
StaticPage1.html
<div>
Hello static world 1!
<div>
Run Code Online (Sandbox Code Playgroud)
我如何在这里做SEO?
我真的需要使用PanthomJS左右做HTML快照.
对于使用桌面应用程序的人员来说,他们如何处理需要重定向 URL 的第三方服务的oauth2流?
我想通过 Discord 的 oauth2 登录对用户进行身份验证。但我正在开发一个桌面应用程序,背后没有网络服务。
我读过有关重定向方案的内容,如下所示:
urn:ietf:wg:oauth:2.0:oob
但不和谐说,通过 oauth2 登录后,这是一个不匹配的重定向网址。
我有一个业务案例,我想从一个帐户(假设帐户 A)到帐户 B 访问集群 Redis 缓存。
我使用了以下链接中提到的解决方案,并且在大多数情况下,它可以工作Base Solution
如果我尝试通过以下方式访问集群 Redis,redis-py
则基本解决方案工作正常,但是如果我尝试使用redis-py-cluster
它失败。
我在 Redis 集群只有一个节点的暂存环境中测试所有这些,但在生产环境中,它有两个节点,因此该redis-py
方法对我不起作用。
下面是我的示例代码
redis = "3.5.3"
redis-py-cluster = "2.1.3"
==============================
from redis import Redis
from rediscluster import RedisCluster
respCluster = 'error'
respRegular = 'error'
host = "vpce-XXX.us-east-1.vpce.amazonaws.com"
port = "6379"
try:
ru = RedisCluster(startup_nodes=[{"host": host, "port": port}], decode_responses=True, skip_full_coverage_check=True)
respCluster = ru.get('ABC')
except Exception as e:
print(e)
try:
ru = Redis(host=host, port=port, decode_responses=True)
respRegular = ru.get('ABC')
except Exception as e:
print(e)
return …
Run Code Online (Sandbox Code Playgroud) 我已将Account kit sdk集成到我的项目中。
我在Facebook开发仪表板上创建了该应用程序,并在其上启用了Account Kit。获得了app-id和客户端访问令牌。
我将其添加到info.plist文件中。我收到此错误:
[AccountKit][Error]: Invalid OAuth 2.0 Access Token
2016-05-31 02:41:32.191 Chat[2919:563260] [AccountKit][Error]:
Persisting App Events due to error:
Error Domain=com.facebook.accountkit:Error Code=200 "(null)"
UserInfo={com.facebook.accountkit:ErrorDeveloperMessageKey=Invalid OAuth access token., NSUnderlyingError=0x147596a30
{Error Domain=com.facebook.accountkit:ServerError Code=190 "(null)" UserInfo={com.facebook.accountkit:ErrorDeveloperMessageKey=Invalid OAuth access token.}}}
Run Code Online (Sandbox Code Playgroud)
请帮忙。谢谢
我希望在Jsp onClick中调用一个方法,该方法在同一个Jsp里面的scriptlet上.
我应该如何存档?
<%@ page import="java.io.*,java.lang.*,java.util.*,java.net.*,java.util.*,java.text.*"%>
<%@ page import="javax.activation.*,javax.mail.*,org.apache.commons.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*"%>
<%!
public String sendMail(String to, String sub, String msg) {
String res = null;
System.out.println("HI");
return res;
}%>
<html>
<head>
<title>Send Email using JSP</title>
</head>
<body>
<center>
<h1>Send Email using JSP</h1>
</center>
<form>
<label>Email To</label><br />
<input type="text" name="to" /><br />
<label>Subject</label><br />
<input type="text" name="sub" /><br />
<label for="body">Message</label><br />
<input type="text" name="msg" /><br />
<input type="submit" onClick="sendMail( to, sub, msg )"/>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
注意:方法名称是"sendMail" …
所以,我一直在做一个 spring boot 项目,现在我正在研究数据库。我认为最好为数据库设置两个用户:
一个可以访问用户表进行login/register/information
更新,另一个可以访问其他表。
我的想法是为两个数据源创建两个单独的 bean,每个 bean 都有一个单独的用户,当用户想要登录时,控制器会相应地更改 JDBCtemplate 数据源。
但我不确定这是否可行,因为 JDBCtemplate 已经定义为 Spring Boot 项目,我不知道它的范围(我假设如果它不是会话 bean,更改数据源将适用于所有用户,而不仅仅是一位用户)
有没有人知道我应该如何解决这个问题?请告诉我!
我正在我的应用程序中实现推送通知。我做了一个 service-worker 来在我的浏览器(Chrome)中显示通知。
现在,我需要调用一个位于 Angular Controller 中的函数。我试图在我的服务工作者中制作这样的事件。
self.addEventListener('push', function(event) {
event.waitUntil(
fetch(self.CONTENT_URL, {headers: headers})
.then(function(response) {
if (response.status !== 200) {
}
return response.json().then(function(data) {
/* some stuff*/
document.dispatchEvent('myEvent');
return notification;
});
})
);
});
Run Code Online (Sandbox Code Playgroud)
在此事件中,我处理通知并尝试使用事件。
在控制器中我写了下面的代码
document.addEventListener('myEvent', function(){
console.log("im here");
});
Run Code Online (Sandbox Code Playgroud)
但是浏览器没有显示 console.log()
有完成这项任务的想法吗?非常感谢!
javascript events push-notification angularjs service-worker
我在我的公司项目中遇到过代码,它是这样的
void pAccount(List<Account> accounts) {
accounts.stream()
.filter(o->getKey(o) != null)
.collect(Collectors.groupingBy(this::getKey))
.forEach(this::pAccounts);
}
private Key getKey(Account account) {
return keyRepository.getKeyById(account.getId());
}
private void pAccounts(Key key , List<Account> accounts) {
//Some Code
}
Run Code Online (Sandbox Code Playgroud)
在调试时,我们得出的结论是pAccount(List<Account> accounts)
调用pAccounts(Key key , List<Account> accounts
.
我试图在网上找到类似的例子,但没有找到与这种行为相匹配的例子。
我想知道这是否是流中允许我们这样做的某种功能,或者是其他功能。
java ×6
javascript ×3
angularjs ×2
oauth ×2
oauth-2.0 ×2
spring-boot ×2
amazon-s3 ×1
base64 ×1
core ×1
criteria ×1
dictionary ×1
docker ×1
electron ×1
events ×1
generics ×1
hibernate ×1
instagram ×1
java-8 ×1
java-stream ×1
jsp ×1
kubernetes ×1
phantomjs ×1
python ×1
redis ×1
rest ×1
scriptlet ×1
sdk ×1
seo ×1
spring ×1
spring-data ×1
spring-mvc ×1
sql ×1
swift ×1